package com.douqu.game.main.server.entity;

import com.bean.core.util.TimeUtils;
import com.bean.core.util.Utils;
import com.douqu.game.core.config.map.CityConfig;
import com.douqu.game.core.factory.DataFactory;

/**
 * @Author: Bean
 * @Description:
 * @Date: 2018-07-24 17:10
 */
public class RecordWorldMapOccupy {

    private long createTime;

    private String occupyPlayerName;

    private String loserPlayerName;

    private int cityId;

    /**
     * 这个名字不为空表示是单人战场
     */
    private String masterPlayerName;

    private int beforeCamp;

    private int afterCamp;

    public RecordWorldMapOccupy()
    {
    }

    public String getRemark()
    {
        StringBuilder remark = new StringBuilder();

        if(!Utils.isNullOrEmpty(loserPlayerName))
        {
            remark.append("打败了[");
            remark.append(loserPlayerName);
            remark.append("],");
        }

        remark.append("成功占领[");

        CityConfig cityConfig = DataFactory.getInstance().getGameObject(DataFactory.CITY_KEY, cityId);
        remark.append(cityConfig==null?cityId:cityConfig.name);
        remark.append("],城的阵营从");
        remark.append(beforeCamp);
        remark.append("变为");
        remark.append(afterCamp);

        return remark.toString();
    }


    public String getType()
    {
        return Utils.isNullOrEmpty(masterPlayerName) ? "世界地图" : "单人战场";
    }

    public int getBeforeCamp() {
        return beforeCamp;
    }

    public void setBeforeCamp(int beforeCamp) {
        this.beforeCamp = beforeCamp;
    }

    public int getAfterCamp() {
        return afterCamp;
    }

    public void setAfterCamp(int afterCamp) {
        this.afterCamp = afterCamp;
    }

    public String getCreateTime() {
        return TimeUtils.getFormatTime(createTime);
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public String getOccupyPlayerName() {
        return occupyPlayerName;
    }

    public void setOccupyPlayerName(String occupyPlayerName) {
        this.occupyPlayerName = occupyPlayerName;
    }

    public String getLoserPlayerName() {
        return loserPlayerName;
    }

    public void setLoserPlayerName(String loserPlayerName) {
        this.loserPlayerName = loserPlayerName;
    }

    public String getMasterPlayerName() {
        return masterPlayerName;
    }

    public void setMasterPlayerName(String masterPlayerName) {
        this.masterPlayerName = masterPlayerName;
    }

    public int getCityId() {
        return cityId;
    }

    public void setCityId(int cityId) {
        this.cityId = cityId;
    }


}
